<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>前端首页</title>
    <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
    <script>
        $(function () {
            $.ajax({
                url: '/test',
                type: 'get',
                dataType: 'json',
                success: function (result) {
                    var json = JSON.stringify(result);
                    $("#context").html(json);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    if (403 == XMLHttpRequest.status) {
                        if (XMLHttpRequest.getResponseHeader("redirect")) {
                            location.href = XMLHttpRequest.getResponseHeader("redirect");
                        }
                    }

                },
            });
        })
    </script>
</head>
<body>

<div>
    <span id="context"></span>
</div>
</body>
</html>